package system.student.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import system.student.annotate.LogRecord;
import system.student.entity.signin.SignInRecord;
import system.student.entity.signin.SignInTask;

public interface SignInTaskMapper {

    @Select("select * from sign_in_task where student_id = #{id} and state = 1")
    SignInTask selectTaskByStudentId(Long id);

    @LogRecord(module = "签到",operation = "签到",operatorType = "签到")
    void insertSignInTask(@Param("signInTask") SignInTask signInTask,@Param("studentId") Long studentId);

    @LogRecord(module = "签到",operation = "学生进行签到",operatorType = "签到")
    void insertSignInRecord(SignInRecord signInRecord);

    @Update("update sign_in_task set state = 0 where teacher_id = #{teacherId}")
    void updateStateToClosed(Long teacherId);
}
